<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
      <el-form-item label="类目名称" style="margin-right: 40px">
        <el-input />
      </el-form-item>
      <!-- <el-form-item label="开线时间" style="margin-right: 40px">
        <el-date-picker type="date" placeholder="选择日期"> </el-date-picker>
      </el-form-item>
      <el-form-item label="结束时间" style="margin-right: 40px">
        <el-date-picker type="date" placeholder="选择日期"> </el-date-picker>
      </el-form-item> -->
      <el-form-item style="margin-right: 40px">
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <div class="button-table">
      <el-button type="primary" @click="addBigKind">新增类目</el-button>
    </div>
    <el-table
      :data="tableData"
      style="width: 100%; margin-bottom: 20px"
      row-key="id"
      default-expand-all
      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
    >
      <el-table-column prop="date" label="类目名称" fixed :align="tableAlign">
      </el-table-column>
      <el-table-column prop="date" label="线类型" :align="tableAlign">
      </el-table-column>
      <el-table-column prop="date" label="开线时间" :align="tableAlign">
      </el-table-column>
      <el-table-column prop="date" label="结束时间" :align="tableAlign">
      </el-table-column>
      <el-table-column prop="date" label="权限战队" :align="tableAlign">
      </el-table-column>
      <el-table-column prop="date" label="创建人" :align="tableAlign">
      </el-table-column>
      <el-table-column prop="date" label="创建时间" :align="tableAlign">
      </el-table-column>
      <el-table-column
        prop="date"
        label="操作"
        fixed="right"
        :align="tableAlign"
      >
        <template slot-scope="scope">
          <el-button type="text">编辑</el-button>
          <el-button @click="handleClick(scope.row)" type="text"
            >新增线</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <el-dialog :title="title" :visible.sync="dialogVisible" width="600px">
        <add></add>
    </el-dialog>
  </div>
</template>
<script>
import  add  from "./add.vue";
export default {
  components: {
    add
  },
  data() {
    return {
      title: "新增类目",
      dialogVisible: false,
      tableAlign: "center",
      queryParams: {
        pageNum: 1,
        pageSize: 20,
      },
      tableData: [
        {
          id: 1,
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          id: 2,
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          id: 3,
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
          children: [
            {
              id: 31,
              date: "2016-05-01",
              name: "王小虎",
              address: "上海市普陀区金沙江路 1519 弄",
            },
            {
              id: 32,
              date: "2016-05-01",
              name: "王小虎",
              address: "上海市普陀区金沙江路 1519 弄",
            },
          ],
        },
      ],
    };
  },
  methods: {
    addBigKind() {
      this.dialogVisible = true;
    },
  },
};
</script>
<style lang="scss" scoped>
.app-container {
  .button-table {
    margin-bottom: 20px;
    display: flex;
    width: 100%;
    justify-content: flex-end;
  }
}
</style>
